import {reqTradeInfo,reqUserAddressList} from '@/api'
const state = {
    tradeInfo:{},
    userAddressList:[]
};
const mutations = {
    REQ_TRADEINFO(state,tradeInfo){
        state.tradeInfo = tradeInfo;
    },
    REQ_USERADDRESSLIST(state,userAddressList){
        state.userAddressList = userAddressList
    }
};
const actions = {
    async getTradeInfo({commit}){
        const result = await reqTradeInfo();
        if(result.code === 200){
            commit('REQ_TRADEINFO',result.data);
        }
    },
    async getUserAddressList({commit}){
        const result = await reqUserAddressList();
        if(result.code === 200){
            commit('REQ_USERADDRESSLIST',result.data)
        }
    }
};
const getters = {};

export default {
    state,
    actions,
    mutations,
    getters,
}